From 856b18db81a433f0742dff6ba1e6cb05af2cc0ca Mon Sep 17 00:00:00 2001 From: Robert Lipe Date: Thu, 29 Dec 2016 02:15:28 -0500 Subject: [PATCH] Make geojson writer not crash when there is no URL to write. --- geojson.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/geojson.cc b/geojson.cc index 5c8fdf491..085ae0fad 100644 --- a/geojson.cc +++ b/geojson.cc @@ -74,12 +74,14 @@ geojson_waypt_pr(const Waypoint* waypoint) { if (!waypoint->description.isEmpty()) { properties["description"] = waypoint->description; } - UrlLink link = waypoint->GetUrlLink(); - if (!link.url_.isEmpty()) { - properties["url"] = link.url_; - } - if (!link.url_link_text_.isEmpty()) { - properties["urlname"] = link.url_link_text_; + if (waypoint->HasUrlLink()) { + UrlLink link = waypoint->GetUrlLink(); + if (!link.url_.isEmpty()) { + properties["url"] = link.url_; + } + if (!link.url_link_text_.isEmpty()) { + properties["urlname"] = link.url_link_text_; + } } if (!properties.empty()) { object["properties"] = properties; -- 2.30.2